/*
 * Created on Jan 9, 2005
 */
package org.scohen.juploadr.event;

import org.scohen.juploadr.app.UploadImage;

/**
 * @author John
 */
public class UploadEvent {
    private double bytesUploaded = 0;
    private boolean uploadStarted;
    private boolean uploadSuccessful;
    private boolean uploadCompleted;
    private String message;
    private UploadImage source;

    public UploadEvent() {

    }

    /**
     * @param affectedImage
     * @param bytesUploaded
     * @param uploadStarted
     * @param uploadSuccessful
     * @param uploadCompleted
     */
    public UploadEvent(UploadImage source, double bytesUploaded,
            boolean uploadStarted, boolean uploadSuccessful) {
        this.bytesUploaded = bytesUploaded;
        this.uploadStarted = uploadStarted;
        this.uploadSuccessful = uploadSuccessful;
        this.source = source;
    }

    public UploadEvent(UploadImage source, double bytesUploaded,
            boolean uploadStarted, boolean uploadSuccessful, String errorMessage) {
        this(source, bytesUploaded, uploadStarted, uploadSuccessful);
        this.message = errorMessage;
    }

    /**
     * @return Returns the uploadCompleted.
     */
    public boolean isUploadCompleted() {
        return this.uploadCompleted;
    }

    /**
     * @param uploadCompleted
     *            The uploadCompleted to set.
     */
    public void setUploadCompleted(boolean uploadCompleted) {
        this.uploadCompleted = uploadCompleted;
    }

    /**
     * @return Returns the uploadCompletion.
     */
    public double getBytesWritten() {
        return this.bytesUploaded;
    }

    /**
     * @param uploadCompletion
     *            The uploadCompletion to set.
     */
    public void setBytesWritten(double uploadCompletion) {
        this.bytesUploaded = uploadCompletion;
    }

    /**
     * @return Returns the uploadFailed.
     */
    public boolean isUploadFailed() {
        return this.uploadSuccessful;
    }

    /**
     * @param uploadFailed
     *            The uploadFailed to set.
     */
    public void setUploadFailed(boolean uploadFailed) {
        this.uploadSuccessful = uploadFailed;
    }

    /**
     * @return Returns the uploadStarted.
     */
    public boolean isUploadStarted() {
        return this.uploadStarted;
    }

    /**
     * @param uploadStarted
     *            The uploadStarted to set.
     */
    public void setUploadStarted(boolean uploadStarted) {
        this.uploadStarted = uploadStarted;
    }

    public String getErrorMessage() {
        return this.message;
    }

    public void setErrorMessage(String message) {
        this.message = message;
    }

    public UploadImage getSource() {
        return source;
    }

    /**
     * @param image
     */
    public void setSource(UploadImage image) {
        source = image;

    }
}